package com.kaiyuan.backend.card.common.entity;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by Eason on 2017/6/15.
 */
public class BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    protected String id;

    protected Integer logicalDel = 0;

    protected Date createTime;

    protected Date updateTime;

    protected Long version;

    public BaseEntity() {
        this.init();
    }

    public static long currentTimeMillis() {
        return System.currentTimeMillis();
    }

    private void init() {
        long now = currentTimeMillis();
        this.createTime = new Date(now);
        this.updateTime = new Date(now);
        this.version = now;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Integer getLogicalDel() {
        return logicalDel;
    }

    public void setLogicalDel(Integer logicalDel) {
        this.logicalDel = logicalDel;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

}
